package treeStudy;

public class TreeDepth {

    /**
     * JZ38 二叉树的深度
     * @param args
     */
    public static void main(String[] args) {

    }

    public int TreeDepth(TreeNode root) {
        return dfs(root);
    }

    public int dfs(TreeNode root){
        if (root == null){
            return 0;
        }
        return 1 + Math.max(dfs(root.left), dfs(root.right));
    }
}
